04: Config facade - #4
Open
nikolaystrikhar wants to merge 3 commits into
Open
Conversation
…tate - Assert Config_Exception is catchable as RuntimeException; nothing covered that inheritance, so dropping it would have left the suite green. - Reset Config in setUp() as well as tearDown(), so the tests asserting on default state no longer depend on class execution order. - Note that the container fixture inherits DI52's class_exists() fallback in has(). - Drop a README pointer to a section that does not exist yet.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What:
Configstatic facade — hook prefix, version, optional container — plusConfig_Exception.Usage:
Why this way: the plan sketched a bare
RuntimeException; this throwsConfig_Exception extends RuntimeException, so the documented contract still holds and callers get one catchable type across the library.set_hook_prefix()validates eagerly rather than at use, because a bad prefix otherwise surfaces as a silently-never-firing filter much later. It also rejects the empty string, which the character-class check alone would accept — that would resurface atget_hook_prefix()as the misleading "you must callset_hook_prefix()" long after the real mistake.lucatume\DI52\Containerimplements PSR-11'sContainerInterface, not StellarWP's, so the tests configure the facade throughTests\Support\Test_Container— a thin adapter modelled on the contract package's own di52 example.Config::set_container()'s signature is unchanged: the StellarWP contract stays the public API, andstellarwp/container-contractremains the only production dependency.Verify:
slic run unit— 19 tests, 28 assertions, green. Covers the validation regex, the empty-prefix and unset-prefix throws, theRuntimeExceptioncatchability, container storage, andreset().get_version()is stored but not yet read by anything; see the spec's known-issue F.